package com.ruoyi.business.enums;

public enum OrderStatus {

    WAIT_QRCODE(0,"等待上码"),
    WAIT_PAY(1,"等待付款"),
    PAY_SUCC(2,"支付成功"),
    TIMEOUT(3,"订单超时"),
    FEE_FAILED(4,"平台收取%s的手续费失败，余额不足请充值");

    private int code;
    private String desc;

    OrderStatus(int code, String desc){
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static OrderStatus get(int code){
        for(OrderStatus os : OrderStatus.values()){
            if(os.getCode() == code ){
                return os;
            }
        }
        return null;
    }
}
